package myGUI3;

import static org.junit.Assert.*;

import org.junit.Test;

import java.util.*;
import java.text.*;

import org.junit.Test;

public class jUnitTestCalendar {

	
	@Test
	public void test_Calendar(){
		String title 	= "ICS 314 Exam";
		String dStart 	= "20130811";
		String dEnd		= "20130815";
		String tStart	= "000000";
		String tEnd		= "020000";
		String loc 		= "University of Hawaii";
		String com		= "Final Exam!";
		String res		= "No books, no cheat sheets!";
		String cl		= "DEFAULT";
		String pri		= "HIGH";
		String freq		= "NONE";
		String cou 		= "0";
		String inter	= "0";
		String desc 	= "This is important!\n";
		iCalEvent3 testiCalEvent = new iCalEvent3(title, dStart, dEnd, tStart, tEnd, loc, com, res, cl, pri, freq, cou, inter, desc);
		
		testiCalEvent.createFile();
		String calendarContent = iCalEvent3.getContent();
		System.out.println(calendarContent);
		
		/*
		String  calendarTitle = "SUMMARY:" + title + "\n" ;
		String expectedTitle = "SUMMARY:ICS 314 Exam\n";
	
	
		String calendardStart = "DTSTART;TZID=America/Los_Angeles:" + dStart + "T" + tStart + "\n";
		String expecteddStart = "DTSTART;TZID=America/Los_Angeles:20130811T000000\n";
		
		//System.out.println(calendardStart);
		//System.out.println(expecteddStart);
		
		String calendardEnd   = "DTEND;TZID=America/Los_Angeles:" + dEnd + "T" + tEnd + "\n";
		String expecteddEnd   = "DTEND;TZID=America/Los_Angeles:20130815T020000\n";
		
		//System.out.println(calendardEnd);
		//System.out.println(expecteddEnd);
		
		String calendarLoc   = "LOCATION:" + loc + "\n";
		String expectedLoc	 = "LOCATION:University of Hawaii\n";
		
		String calendarCom	 = "COMMENT:" + com + "\n";
		String expectedCom 	 = "COMMENT:Final Exam!\n";
		
		String calendarRes 	 = "RESOURCES:" + res + "\n";
		String expectedRes	 = "RESOURCES:No books, no cheat sheets!\n";
		
		String calendarClass = "CLASS:" + cl + "\n";
		String expectedClass = "CLASS:DEFAULT\n";
		
		String calendarPri   = "PRIORITY:" + pri + "\n";
		String expectedPri 	 = "PRIORITY:HIGH\n";
		
		
		assertEquals(expectedTitle, calendarTitle);
		assertEquals(calendardStart, expecteddStart);
		assertEquals(calendardEnd, expecteddEnd);
		assertEquals(calendarLoc, expectedLoc);
		assertEquals(calendarCom, expectedCom);
		assertEquals(calendarClass, expectedClass);
		assertEquals(calendarPri, expectedPri);
		*/
		
		String calendarCompare = "BEGIN:VCALENDAR\n"+
				"VERSION:2.0\n"+
				"PRODID:-//teamflagler/ics314//HUYNGHIEM v2.0//EN\n"+
				"BEGIN:VTIMEZONE\n"+
				"TZID:America/Los_Angeles\n"+
				"BEGIN:DAYLIGHT\n"+
				"COMMENT:Info for daylight savings\n"+
				"DTSTART:19330430T020000\n"+
				"TZNAME:Pacific Daylight Time\n"+
				"RDATE:19330430T020000\n"+
				"END:DAYLIGHT\n"+
				"BEGIN:STANDARD\n"+
				"COMMENT:Info for standard time\n"+
				"DTSTART:19470608T020000\n"+
				"TZNAME:Pacific Standard Time\n"+
				"RDATE:19470608T020000\n"+
				"END:STANDARD\n"+
				"END:VTIMEZONE\n"+
				"BEGIN:VEVENT\n"+
				"COMMENT:Final Exam!\n"+
				"CREATED:20130811T220832Z\n"+
				"UID:<>\n"+
				"CLASS:PUBLIC\n"+
				"PRIORITY:HIGH\n"+
				"DTSTART;TZID=America/Los_Angeles:20130811T000000\n"+
				"DTEND;TZID=America/Los_Angeles:20130815T020000\n"+
				"TRANSP:OPAQUE\n"+
				"SUMMARY:ICS 314 Exam\n"+
				"LOCATION:University of Hawaii\n"+
				"RESOURCES:No books, no cheat sheets!\\n"+ 
				"DTSTAMP:20130811T220832Z\n"+
				"DESCRIPTION:This is important!\n"+
				"END:VEVENT\n"+
				"END:VCALENDAR\n";
		
		System.out.println(calendarCompare);
		assertEquals(calendarCompare.length()+2, calendarContent.length());//Add two to make up for the setDescription method adding "//" in escape sequence
		
	}

}
